import { legacy_createStore as createStore, applyMiddleware, combineReducers } from "redux";
import { thunk } from "redux-thunk";
import countReducer from "./reducers/count";
import persionReducer from "./reducers/persion";

/**
 * 目前createStore已经弃用，所以我们要引用legacy_createStore 
 * compose：用来合成函数，在同时配置applyMiddleware、devtool时候需要引入
 * applyMiddleware：使用中间件来增强store
 * thunk：创建异步actions
 * devtool：判断浏览器是否有安装调试的插件，有则启用
 */
// const devtool = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()

export default createStore(
  combineReducers({
    count: countReducer,
    persion: persionReducer
  }),
  applyMiddleware(thunk)
  // compose(applyMiddleware(thunk), devtool)
)